home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE3 / POWERBASE / DOCS / !!Tutorial < prev    next >
Text File  |  2001-12-06  |  48KB  |  868 lines

  1.                                 =========
  2.                                 POWERBASE
  3.                                 =========
  4.  
  5.                         © Derek and Steven Haslam
  6.  
  7.                         =======================
  8.                         Tutorials for Powerbase
  9.                         =======================
  10.  
  11. Powerbase is an extremely powerful program with a great many features, but
  12. that doesn’t mean it is difficult to use.  The procedures to search for,
  13. add, delete, edit and print records can be learned very quickly but, as with
  14. any new piece of software, the first steps often take the longest. This
  15. booklet uses some ready made example databases supplied on the distribution
  16. disc to help familiarise you with the main functions of the program.
  17.  
  18. It consists of two sections. The first is a Quick Tutorial aimed at
  19. inexperienced users who may not have used a database program before. The
  20. Main Tutorial is meant for people who, although new to Powerbase, have some
  21. familiarity with other database programs. If you fall into this category you
  22. could skip the Quick Tutorial and move straight on to the Main Tutorial.
  23.  
  24. The Figs.1-5 referred to in the text will be found in the supplied Drawfiles
  25.  
  26.                            ==============
  27.                            Quick Tutorial 
  28.                            ==============
  29.  
  30. This tutorial is intended to acquaint the new user as painlessly as possible
  31. with the most commonly-used facilities of Powerbase. It does not explain how
  32. to create a database from scratch (for this, see  Ch04-Creat in the Docs
  33. archive), nor does it delve into the many advanced features, but it does
  34. explain how to:
  35.  
  36. (a)     Start up Powerbase and open an existing database.         
  37. (b)     Browse through the database and search for individual records.        
  38. (c)     Add new records and alter or delete existing ones.         
  39. (d)     Query the database to create simple reports.         
  40. (e)     Close the database. 
  41.  
  42. The supplied sample database Friends is used to illustrate most of these
  43. activities. If you have a hard disc you should copy Friends and Powerbase
  44. itself onto it before proceeding further. It is possible to use Powerbase
  45. from floppy discs but some operations, such as printing lists, will be quite
  46. slow. Unless memory is very tight users of floppy discs are recommended to
  47. allocate at least 32K to the RAM disc and copy Friends onto it. Everything
  48. will then run much faster. Powerbase can provide context-sensitive help on
  49. its windows and menus via Acorn’s interactive Help application and you are
  50. advised to load this, resizing the help window and placing it at a
  51. convenient place on the screen. Further help can be had by choosing the Help
  52. entry which will be found on Powerbase’s main menu and also on the iconbar
  53. menu.  The ultimate source of help is, of course, the main printed manual or
  54. the set of text files in the Docs archive.
  55.  
  56. 1  Starting Powerbase
  57. =====================
  58. Double-click on the Powerbase icon. After a few seconds it will appear on
  59. the iconbar with the words “No data” beneath it to show that no database is
  60. open. Dragging the Friends icon to the Powerbase icon on the iconbar will
  61. open Friends for use and the words “No data” will be replaced by the name of
  62. the database.
  63.  
  64. Two windows will open. One is the record window and displays the first
  65. record in the database, the one for Badgery, Peter. The other is the keypad
  66. which allows you to control the browsing, searching and editing functions of
  67. Powerbase.  The keypad is rather large and obscures quite a big area of the
  68. record window, but the most-used buttons are on the top two rows. Clicking
  69. the “toggle size” icon (the small square at the right-hand end of its title
  70. bar) will reduce the keypad to just these rows.  A second click restores it
  71. to full size. The keypad (in its reduced form) is shown in Fig.1 with
  72. numbers to identify the buttons referred to in these tutorials. (NOTE: If
  73. you are reading from the !!Tutorial textfile load the appropriate drawfile
  74. to see Figs.1 and 3, 2, 4 and 5)
  75.  
  76. 2  Browsing and Searching
  77. =========================
  78. Now that you have a database running we will find out how to move from
  79. record to record and how to access any specific record by using a small
  80. group of letters called the key of the record.  All the mouse clicks
  81. referred to (other than those for displaying menus) are made with the SELECT
  82. (left) button. If the chosen keypad action has an obvious opposite then you
  83. will find that using the ADJUST (right) mouse button brings about that
  84. effect.  e.g. While SELECT on keypad button (4) takes you one record forward
  85. in the file, ADJUST on the same keypad button takes you one record back.
  86.  
  87. 2.1 Browsing through the Records
  88. --------------------------------
  89. The top row of buttons on the keypad allows you to browse through the file.
  90. If you have Help running, as previously suggested, it will tell you what
  91. each button does. Once you get the general idea you will find the symbols on
  92. the buttons logical and self-explanatory. The most commonly used ones act as
  93. follows:
  94.  
  95. (a) Buttons (1) and (2) take you to the first and final records. You are
  96.     at the first record now, so click with SELECT on (2) and you will see
  97.     the record for Turnip, Charles. (1) takes you back to Badgery, Peter 
  98.     again.  
  99.  
  100. (b) Movement through the file one record at a time is achieved using (3)
  101.     and (4). Try them out, noting the way records come up in alphabetical, 
  102.     or reverse alphabetical, order.  
  103.  
  104. (c) Buttons (5) and (6) let you make longer jumps through a file. The number
  105.     of records skipped is shown in the writable icon (7) and has a default 
  106.     value of 10. As there are only 10 records in Friends these keys will have
  107.     the same effect as the “first” and “final” keys, unless you make the 
  108.     interval smaller. Click in (7), delete the 10 and enter 5 or 2, then try 
  109.     buttons (5) and (6) again.
  110.  
  111. 2.2 Searching for a record
  112. --------------------------
  113. Button (8) shows a question mark followed by a “record card” icon. We will
  114. call it the Search button. When clicked with SELECT a small window opens to
  115. the right of the keypad. (See Fig.2) This is the Search window and contains
  116. a writable icon in which to enter the key of the record you wish to display. 
  117. In this database keys are made up from the first 4 letters of the surname
  118. plus the initial so, if you wanted to call up the record for Bloggs Fred you
  119. would enter BLOGF. Do so, then click on Find (or type the Return key on the
  120. keyboard) and the record will be displayed. Note that the key is shown in
  121. the heading of the record window.
  122.    
  123. If you enter a non-existent key Powerbase displays the record which most
  124. nearly matches the key, but flashes the key field to warn you that what is
  125. being displayed is not what you asked for.
  126.  
  127. 3  Editing the Database
  128. =======================
  129. This part of the tutorial involves changes to the data. Make a working copy
  130. of the disc and put the original in a safe place. If you are using a copy of
  131. Friends on the RAM disc then the floppy disc won’t be altered, but it’s
  132. still not a good idea to work with the original disc.
  133.  
  134. 3.1 Modifying records
  135. ---------------------
  136. Point at any field and click SELECT. The red text caret will appear in the
  137. field. The contents of the field may now be edited with the aid of the
  138. keystrokes which are standard for all RISC OS writable icons. i.e.
  139.  
  140. Ctrl U                  clears the field.       
  141. Delete                  removes the character to the left of the caret.        
  142. Copy (or End)           removes the character to the right of the caret.        
  143. Shift Copy/End          deletes the word to the right of the caret.        
  144. Ctrl Copy/End           deletes everything from the caret to the end of the line.
  145.  ⇦ and ⇨                move the caret left/right by one character.        
  146. Shift ⇦ and Shift ⇨     move the caret left/right by one word.        
  147. Ctrl ⇦ and Ctrl ⇨       move the caret to start and end of the field.
  148.            
  149. Having modified one or more fields you may be wondering what you have to do
  150. to make Powerbase save the modified record so that the changes won’t be
  151. lost. You don’t need to do anything! Powerbase will ensure that your changes
  152. are saved when you display a different record or close the database.
  153.  
  154. 3.2 Recovering data after a mistake
  155. -----------------------------------
  156. You may edit the wrong field by mistake and want to restore the previous
  157. contents. Call up Bloggs Fred’s record and change the address from “12
  158. Woodland Road  Exeter” to “12 Woodville Road  Exmouth”.  Now click MENU over
  159. the first line of the address. The second entry on the main menu (Field)
  160. contains a short group of characters called the tag of the field, in this
  161. case ADD1. Slide off the menu to the right, which opens the Field sub-menu,
  162. and choose the next to last entry; Undo changes. The contents of the field
  163. will revert to “12 Woodland Road”. Notice that only the first line of the
  164. address is affected; the town is still “Exmouth”.  If you want to restore
  165. that field as well click MENU over it and follow the procedure just
  166. described.
  167.  
  168. There might be occasions when you make a hopeless mess of a record and want
  169. to discard all the changes and revert to what you started with.  You could,
  170. of course, “undo” each field separately as we just did for the street
  171. address and town but there’s a quicker way.  Look near the bottom of the
  172. main menu, (just above Help) and you will see that here too is an Undo
  173. changes option. Choosing this undoes all the alterations you have made.
  174.  
  175. It is important to realise that these facilities depend on the fact that
  176. Powerbase holds the currently-displayed record in memory and will therefore
  177. only work if the altered record has remained on display from the time you
  178. started changing it up to the point where you decided to “undo”. If you have
  179. looked at another record or clicked on Force update in the meantime then the
  180. changes will have been written to the disc and thus become “permanent”.
  181.  
  182. 3.3 Adding and deleting records
  183. -------------------------------
  184. To add a new record we use button (9), Add record which looks like a plus
  185. sign and an index card. Clicking on this offers a blank record into which
  186. you can type new data. You don’t have to complete all the fields, in fact
  187. the only field into which you must type something is the NAME field. This is
  188. the key field; the one from which the key, mentioned earlier, is derived. If
  189. you leave the key field blank then nothing will be written to the database.
  190.  
  191. Type the name “Bodmin George”, then go to the beginning of the file and
  192. step through it record by record. You will find that your new record has
  193. been inserted in the correct place, i.e. the sequence goes: Badgery, Bloggs,
  194. Bodmin, Cavendish.  Now try deleting the record you’ve just added. If you
  195. refer to Fig.3 (which shows the portion of the keypad below the first two
  196. rows) you will see a “dustbin” button − (14) − which will do exactly that,
  197. but don’t use it just yet. Make sure that the unwanted record is on the
  198. screen and click button (16) instead. You will now find that Bodmin’s record
  199. has vanished; the names run straight from Bloggs to Cavendish, just as they
  200. did before you added Bodmin. 
  201.  
  202. This looks a bit too easy. Suppose you clicked the button by mistake and
  203. deleted an important record?  No problem; what you have just done has been
  204. made easy because the action is far less drastic than it looks. The record
  205. hasn’t really been deleted at all. Click button (19) and “Bodmin” will
  206. reappear. You will soon find, however, that it appears to be the only record
  207. in the file! Don’t worry; nothing has been lost. A Powerbase database is
  208. treated as six separate subfiles numbered 0−5. When you first open the
  209. database you are looking at Subfile 0 and the heading of the record window
  210. shows this. If you look at the heading now you will see that it has changed
  211. to Subfile 1.  Buttons (18) and (19) are used to change the current subfile.
  212.  
  213. Buttons (15) and (16) do not delete records; they merely move records from
  214. one subfile to another. Button (16) moves the displayed record to the next
  215. subfile in sequence. Thus, in the above case the “Bodmin” record has been
  216. moved from subfile 0 to subfile 1. A record in subfile 1 would be moved to
  217. subfile 2 and so on. When it gets to 5 the next click moves it into subfile
  218. 0 where it was originally. As you may have guessed, button (15) moves
  219. records in the opposite direction, i.e. from subfile 1 to 0 or from subfile
  220. 0 to 5.
  221.  
  222. If you do want to lose a record for good you consign it to the dustbin by
  223. clicking on (14).  As this button’s action is more drastic than that of the
  224. other two you are given a chance to change your mind. A window  headed
  225. Powerbase: please confirm: will appear displaying the question Delete record
  226. permanently? Clicking OK causes the record to be deleted, Cancel removes the
  227. warning window from the screen leaving the record untouched.
  228.  
  229. 4  Printing Lists
  230. =================
  231. Before Powerbase can produce a list it must be told:
  232.  
  233. •       which fields should appear on the list 
  234. •       which records should appear on the list
  235.  
  236. 4.1 Making the field selection
  237. ------------------------------
  238. Specifying the fields you want is extremely easy. To include a field point
  239. at it and click with ADJUST. The selected field will then appear with its
  240. foreground and background colours reversed. If you change your mind you can
  241. de-select it by clicking on it again with ADJUST. The order in which you
  242. select the fields is the order in which they will appear in the printed
  243. list.  
  244.  
  245. Take care with this as there is nothing on the screen to indicate
  246. what order the fields will be in (but see section 4.2 below). Field
  247. selections may be saved (using Save selection from the Print submenu) and
  248. reloaded for future use. For now select the name and the first 3 fields of
  249. the address.
  250.  
  251. 4.2 Choosing which records to print
  252. ----------------------------------- 
  253. Specifying which records to print is somewhat more complicated. With the
  254. mouse pointer in the record window click MENU. This displays the main
  255. Powerbase menu from which you should choose Print. (You can achieve the same
  256. effect by typing the Print key on the keyboard.) A window called the Match
  257. window will open:
  258.  
  259. Unless you have selected at least one field, as described in 4.1 the menu
  260. button (X) will be greyed out as illustrated. Otherwise, clicking on it will
  261. display a list of the selected fields in order of selection.
  262.  
  263. The caret will be in the writable icon. This is where you specify the
  264. criteria which must be met by records for inclusion in the list. If you just
  265. click on the Print button (or type Return) without entering anything, you
  266. will obtain a list of the whole database (or, more accurately, of the the
  267. whole of the current subfile). Try that first.
  268.  
  269. When the process is complete the list will be displayed in a window. If
  270. no records at all are printed make sure the icon for subfile 0 (Y in Fig. 4)
  271. is highlighted. Click on it with SELECT if it isn’t. If you point to a
  272. record in the list and double-click with SELECT Powerbase will display the
  273. chosen record in the main record window. Note that the caret is placed in
  274. the field you were pointing to on the list. This is very useful if you spot
  275. errors in the data whilst examining a list. A double click on the offending
  276. item offers the record with the caret correctly positioned for editing.
  277.  
  278. Most queries involve printing only some of the records, not the whole
  279. database. To target a particular group of records we need to enter a search
  280. formula which will distinguish the records we want to print from all the
  281. rest of the records. Search formulae can be quite complex and a more
  282. detailed treatment is given in the Manual. Only a few simple examples are
  283. shown here.  Enter the following and before clicking on Print.
  284.  
  285.                           ADD2=Exeter 
  286.  
  287. The report window appears showing just one record: the one for “Bloggs
  288. Fred”. ADD2 is called the tag of the field. The label which appears beside a
  289. field on the screen is called its descriptor and you might have expected
  290. such labels to be used to refer to fields in search formulae. This is not
  291. done for two reasons:
  292.  
  293. (1)     Descriptors can be inconveniently long for use in this way.
  294. (2)     Fields don’t necessarily have descriptors. 
  295.  
  296. Of the 5 address fields only the first and last have descriptors (Address
  297. and Postcode respectively). Since every data field needs a “handle” of some
  298. sort so that we can include it in a search formula we give each a tag, which
  299. is never more than 4 characters. Clicking MENU over a field makes its tag
  300. appear in the second menu item.
  301.  
  302. The record for “Bloggs Fred” is, however, not the only one with an address
  303. in Exeter. There is another (“Sunningdale Samantha”) but with Exeter in ADD3
  304. rather than ADD2. You can print both on the same list by using the  formula:
  305.  
  306.                        ADD2,ADD3=Exeter
  307.  
  308. Notice the way the alternative tags are separated by commas. We call this a
  309. tag list. A record will be printed if any one of the tags in the tag list is
  310. matched. The part of the search formula after the = sign is called the
  311. target and here too we may specify several in a target list. Try the
  312. following:
  313.  
  314.                      ADD3=Exeter,Anytown
  315.  
  316.        and also:   ADD2,ADD3=Exeter,Anytown 
  317.  
  318. The first of these examples prints the records for “Soap Joe” and
  319. “Sunningdale Samantha”, the second prints these two and “Bloggs Fred” as
  320. well. What the second formula is saying is “Print all the records which have
  321. either ‘Exeter’ or ‘Anytown’ in either the ADD2 or ADD3 field”.
  322.  
  323. The characters we want to match don’t, of course, always make up the entire
  324. field. You can also search for part of a field. Suppose you wanted the
  325. records for people called Peter, Fred and Jean. Enter the formula:
  326.  
  327.                       NAME{Peter,Fred,Jean 
  328.  
  329. and you will find that the records for “Badgery Peter”, “Bloggs Fred” and
  330. “Ford Jean” are printed. The curly bracket (“{”) means “contains”. i.e. the
  331. name field doesn’t have to consist wholly of Peter, or Fred or Jean, but has
  332. to contain one of these names somewhere within it.
  333.  
  334. 4.3 Hard copy
  335. ------------- 
  336. So far you have displayed reports in a window. If you want to send them to
  337. your printer run Printers, switch on the printer, then click MENU over the
  338. displayed report. The Save as text option leads to a standard Save box from
  339. which you can drag the file icon to Printers on the iconbar. You could also
  340. drag it to a directory window to save it. Or you could simply type Return,
  341. in which case the report would be saved under a suitable default name in a
  342. directory called PrintJobs inside the Friends database directory. Every
  343. Powerbase database has a PrintJobs directory to use as a general dumping
  344. ground for reports and which needs to be cleared out periodically. Choose
  345. Show jobs done from the Print submenu to display it.
  346.  
  347. If your printer is one of the more recent inkjets you might not be able to
  348. print plain text files by simply dragging them to the Printers icon as
  349. described above, because some such printers contain no fonts of their own.
  350. Clicking the icon Z in Fig.3 will open Powerbase’s Print Options window, at
  351. the top of which is an area marked Destination. Select the Printer button
  352. instead of the Window button and click on Accept. You should now be able to
  353. send output directly to the printer provided it is ready for use and
  354. Printers is running.
  355.  
  356. 5  Closing down
  357. ===============
  358. A database may be closed down by choosing Close database from the iconbar
  359. menu. When you do so all relevant data stored in memory is saved to disc and
  360. the database is closed. You do not have to do anything to save the database
  361. file itself to disc since it has been there all along. Only the current
  362. record is in memory at any one time and this is automatically written back
  363. to disc when it has been changed in any way.
  364.  
  365. If you are going to use another database straight away just double click on
  366. it or drag it to the Powerbase icon on the iconbar. In fact you don’t even
  367. need to close the previous database before doing this; Powerbase will do it
  368. for you.  When working with a database on the RAM disc Powerbase will issue
  369. a warning that the data is not secure and that you need to drag it from the
  370. RAM disc to a floppy or hard disc before switching off.  To terminate
  371. Powerbase itself use the Quit option on the iconbar menu.
  372.  
  373.                                 =============
  374.                                 Main Tutorial
  375.                                 =============
  376.  
  377. This section is intended to acquaint a new user with the most commonly-used
  378. facilities of Powerbase. It does not explain how to create a database from
  379. scratch but it does explain how to:
  380.  
  381. (a)     Start up Powerbase and open an existing database.         
  382. (b)     Browse through the database and search for individual records.         
  383. (d)     Add new records and alter or delete existing ones.         
  384. (d)     Query the database to create simple reports.         
  385. (e)     Close the database. 
  386.  
  387. The sample database Elements is used to illustrate these activities. If you
  388. have a hard disc copy Elements and Powerbase itself onto it before
  389. proceeding further. It is possible to use Powerbase with floppy discs but
  390. some operations, such as printing lists, will be slow. Unless memory is very
  391. tight users of floppy discs are recommended to allocate at least 112K to the
  392. RAM disc and copy Elements onto it, which will make it much faster.
  393. Powerbase can provide context-sensitive help via Acorn’s interactive Help
  394. application and you are advised to load this, resizing the help window and
  395. placing it at the top right of the screen. Further help can be had by
  396. choosing the Help entry on Powerbase’s main menu or on the iconbar menu. 
  397.  
  398. 1  Starting Powerbase
  399. =====================
  400. Double-click on the Powerbase icon. After a few seconds it will appear on
  401. the iconbar with the words “No data” beneath it to show that no database is
  402. open. Dragging the Elements icon onto the Powerbase icon on the iconbar will
  403. open Elements for use and the words “No data” will be replaced by the name
  404. of the database. Double-clicking on the Elements icon has the same effect,
  405. in fact if Powerbase isn’t already on the iconbar a double-click on Elements
  406. will install it for you provided that the Powerbase icon has been seen by
  407. the filer.
  408.  
  409. Two windows will open. One is the record window and displays the first
  410. record in the database. The other is the keypad which allows you to control
  411. the browsing, searching and editing functions of Powerbase. The keypad is
  412. rather large and obscures quite a big area of the record window. The
  413. most-used buttons, however, are on the top two rows and clicking the
  414. toggle-size icon at the top right-hand corner reduces it to just these rows.
  415. A second click restores the keypad to full size. Fig.1  in the Quick
  416. tutorial (printed version) shows the keypad in its reduced state and Fig.3
  417. shows the rest of the keypad which is revealed when you click it to full
  418. size. Load the drawfile Keypad if you are working from the !!Tutorial
  419. textfile. The numbers in brackets which occur in this tutorial refer to the
  420. numbering of the buttons in these two illustrations.  
  421.  
  422. 2  Browsing and searching
  423. =========================
  424. Now that you have a database running we will find out how to move from
  425. record to record and how to access any particular record by using a small
  426. group of letters called the key of the record.  All the mouse clicks
  427. referred to (apart from those used to display menus) are made with the
  428. SELECT (left) button. If the chosen keypad action has an obvious opposite
  429. then you will find that using the ADJUST (right) mouse button brings about
  430. that effect.  e.g. While SELECT on the top left keypad button takes you to
  431. the start of the file, ADJUST on the same keypad button takes you to the
  432. end.
  433.  
  434. 2.1 Browsing through the records
  435. --------------------------------
  436. The top row of buttons on the keypad allows you to browse through the file.
  437. If you have !Help running, as previously suggested, it will tell you what
  438. each button does. Once you get the general idea you will find the symbols on
  439. the buttons logical and self-explanatory. The most commonly used ones act as
  440. follows:
  441.  
  442. (a)     Buttons (1) and (2) take you to the beginning and end of the file.
  443.         (2) takes you to ZIRCONIUM and (1) to ACTINIUM. 
  444.  
  445. (b)     Buttons (3) and (4) move by one record at a time. From ACTINIUM, 
  446.         clicking (4) takes you to ALUMINIUM whilst (3)  takes you back to 
  447.         ACTINIUM.  
  448.  
  449. (c)     Buttons (5) and (6) go through the file by longer jumps (6) takes you
  450.         from ACTINIUM to BISMUTH and (5) back to ACTINIUM. The “fast forward/
  451.         rewind” value is shown in the writable icon (7). It is initially set
  452.         to 10 but can be altered by clicking in it with SELECT and entering a 
  453.         new value.
  454.  
  455. At either end of the file “wrap around” occurs. If you are at the final
  456. record (ZIRCONIUM) one record forward takes you to ACTINIUM again.
  457. Similarly, one record back from ACTINIUM goes to ZIRCONIUM.
  458.  
  459. The second row has buttons (10) and (11) marked like the “play” and “stop”
  460. controls of a cassette player. (10) starts an automatic flip-through of the
  461. records without the need to touch any other buttons. When you get to the
  462. place you want, click on (11). If the records go past too quickly you can
  463. slow the process down by increasing the number in the writable icon (7).
  464. (This is normally used to set the “fast-wind” interval; see above.)
  465.  
  466. 2.2 Key fields, Keys and Indices
  467. --------------------------------
  468. When using the six buttons on the top row of the keypad you will have
  469. noticed that the records appear to be arranged alphabetically by the name of
  470. the element. The actual order in which records occur in the file is in fact
  471. nothing like alphabetical, but the order in which they are accessed is
  472. determined by an index which forces them to appear in alphabetical order.
  473. Every database must have at least one index, but you can have as many extra
  474. ones as you wish (subject to memory and disc limitations).
  475.                             
  476. The second row of the keypad has buttons (12) and (13) which feature a blue
  477. arrow with a key symbol. Click on (13) and the record for HYDROGEN is
  478. displayed. If you now experiment with the top row of buttons as before you
  479. will find that the records no longer appear in alphabetical order of name
  480. but in order of Atomic number instead. What we have done is change to a
  481. different index. If a database has several indices buttons (12) and (13)
  482. allow you to cycle through them in opposite directions. Since Elements has
  483. only two indices the two buttons have exactly the same effect. When you
  484. change to a different index the screen always displays the first record as
  485. determined by that index.
  486.  
  487. An index is built from keys which are derived from a particular key field.
  488. The two indices used by Elements are based on the Name and Atomic number
  489. fields. The way in which the key stored in the index is derived from the key
  490. field differs in the two cases. For the Name index the first four letters of
  491. the name are used. Since no two elements have names beginning with the same
  492. four letters this gives a unique value for the key. (Two letters would not
  493. be enough because of names like CHLORINE and CHROMIUM.) The Atomic number
  494. index is based on the whole 3-digit maximum length and the ordering is
  495. numeric. Whenever a record is displayed the key is shown in the window
  496. title.
  497.  
  498. The record screen shows which fields are key fields and which are not. The
  499. labels, or descriptors, of fields are normally black. Where the fields are
  500. key fields they are shown in dark blue instead and the field related to the
  501. current index has its descriptor in red. Note also that the background
  502. colour of the NAME field is pale yellow whereas the rest are white. This
  503. indicates that NAME is the primary key field. The primary key is more
  504. important than the others. The index based on it is the only one which every
  505. database must have and is the one selected when a database is first opened.
  506.  
  507. 2.3 Searching for a record
  508. --------------------------
  509. Button (8) shows a question mark followed by a “record card” icon  We will
  510. call it the Search button. When clicked with SELECT a small window, the
  511. Search window, opens to the right of the keypad (see Fig.2). It contains a
  512. writable icon in which to enter the key of the record you wish to display.
  513. Suppose you want to see the record for the element NITROGEN. If the current
  514. index is the Name then enter NITR and either type the Return key on the
  515. keyboard or click on the Find button. The required record quickly appears.
  516. If you enter the key of a non-existent record Powerbase displays the record
  517. which most nearly matches the key, but flashes the key field to warn you
  518. that what is being displayed is not what you asked for. You don’t
  519. necessarily need to type the whole key; NIT would do in this case, but NI
  520. would be ambiguous (there are elements called NICKEL and NIOBIUM). 
  521.  
  522. To find NITROGEN when the Atomic number index is active you would need to
  523. know that the atomic number of nitrogen is 7. Change key, enter this number
  524. and type Return or click on Find. The required record appears. Abbreviated
  525. keys are not allowed in this case for obvious reasons; if you want element
  526. 103 (LAWRENCIUM) it’s no good entering 10 (NEON)!
  527.  
  528. You might want to examine a group of related records, e.g. the six similar
  529. elements LITHIUM, SODIUM, POTASSIUM, RUBIDIUM, CAESIUM and FRANCIUM which
  530. are known as the Alkali Metals. You could, of course, look up each in turn
  531. by entering its key but there is a better way. Click on (17); the Filter
  532. button. The button becomes ticked and the Filter window (Fig.5) opens on the
  533. right of the keypad. This button is what we call an option switch and is
  534. used to turn a particular feature ON or OFF. The six elements referred to
  535. all occur in group 1 of the Periodic Table of the elements so type GP=1 into
  536. the writable icon. and click on Filter (in the Filter window, not on the
  537. keypad).  The record for CAESIUM is displayed.  If you experiment with the
  538. buttons on the top row of the keypad you will find that they behave as if
  539. the six Alkali Metals were the only elements in the database; all the rest
  540. have been “filtered out” so that you access only the ones you are interested
  541. in.  To return to normal operation either click the Cancel button on the
  542. Filter window or turn off the switch on the keypad. If you want the Filter
  543. window out of the way without cancelling the filter click on Close.The
  544. option switch on the keypad remains selected.
  545.  
  546. 3  Editing the Database
  547. =======================
  548. This part of the tutorial involves changes to the data records. Make a
  549. working copy of the disc and put the original in a safe place. If you are
  550. using a copy of Elements on the RAM disc the floppy disc won’t be altered,
  551. but it’s not a good idea to work with the original disc.
  552.  
  553. 3.1 Modifying records
  554. ---------------------
  555. Pointing the mouse at any field and clicking SELECT places the caret in that
  556. field. The contents of the field may then be edited in the standard way for
  557. RISC OS writable icons, with which you will be familiar. Changes made to a
  558. record cause the record to be written back to the database whenever you
  559. display a different record or close the database. There is a button (24) on
  560. the keypad called Force update but you don’t normally need to use it.
  561.  
  562. 3.2 Using the scratchpad
  563. ------------------------
  564. It is sometimes necessary to copy the contents of one field into another,
  565. either in the same record or a different record. This can be done with the
  566. aid of the scratchpad which is controlled by buttons (21) and (22). Place
  567. the caret in the field you want to copy and click on (21). This copies the
  568. contents of the field onto the scratchpad. Moving the caret to another field
  569. and clicking (22) writes the data from the scratchpad into that field,
  570. over-writing its previous contents. You may continue to “paste” the data
  571. into new fields as often as you like. Only when you click (21) again are the
  572. contents of the scratchpad changed. Data pasted into a field will not be
  573. allowed to overflow; if too long for the field it will be cut to the
  574. permitted length. As an added precaution you can’t paste into a field if
  575. there is nothing on the scratchpad so accidental blanking of fields is
  576. avoided.  If you use a wordprocessor, whether on an Acorn machine or not,
  577. you will probably be familiar with the keystrokes Ctrl-C and Ctrl-V for Copy
  578. and Paste. You can use these in Powerbase too; they do exactly the same as
  579. buttons (21) and (22)
  580.  
  581. 3.3 Undoing mistakes
  582. --------------------
  583. You might edit the wrong field by mistake and want to restore the previous
  584. contents. Click MENU over the field. The second entry on the main menu
  585. contains the tag of the field. Slide off the menu to the right to open the
  586. Field sub-menu and choose Undo changes. The previous contents of the field
  587. will be restored. Similarly, if you make a mess of a whole record and want
  588. to go back to the way it was you can choose Undo changes from the main menu.
  589. It is important to realise that the Undo facilities will not work if you
  590. have looked at another record before using them (or clicked on Force
  591. update). You can only recover data which has been altered in or removed from
  592. the currently-displayed record.
  593.  
  594. 3.4 Adding new records
  595. ----------------------
  596. First we will add a new record for a fictitious element as described below:
  597.  
  598.         NAME            TASMANIUM                    
  599.         SYMBOL          Ts                    
  600.         ATOMIC NUMBER   108 
  601.  
  602. Button (9) has a plus sign and a “record card” icon. This is the Insert
  603. button. A blank record will be displayed with the caret in the NAME field. 
  604. Enter TASMANIUM here and type Return. The caret will jump to the SYMBOL
  605. field. Enter Ts. You will now need to press Return twice to get to ATOMIC
  606. NUMBER (One press takes you to the field after NAME where the origin of the
  607. element’s name is given. The field has no descriptor.) Alternatively you
  608. could point the mouse at the ATOMIC NUMBER field and click SELECT. There is
  609. no need to press Return after entering a field in order to accept the data;
  610. it’s just the most convenient way of getting to the next field.  When
  611. entering data into widely-scattered fields it is more convenient to use the
  612. mouse to move the caret.
  613.  
  614. Having entered the data click any of the first row of buttons so that a
  615. different record is shown. Now use Search to find TASMANIUM by name (its key
  616. will be TASM). Change to the Atomic number index and find it by atomic
  617. number (108). In both cases try moving to the record just before and just
  618. after the new one, noting that it has been placed in its correct position in
  619. both indices: between TANTALUM and TECHNETIUM in the Name index and at the
  620. end of the Atomic number index. 
  621.  
  622. 3.5 Data Input Validation
  623. -------------------------
  624. When entering the above data you may have noticed that the Name field will
  625. only accept capital letters and the Atomic number field will only accept
  626. numerals. Any others are simply ignored. We call this feature character
  627. validation. Another level of data validation, which we will now illustrate,
  628. is called table validation  Make an entry in the Group field. Type X, for
  629. example, then try to move to another field by either typing Return or
  630. clicking the mouse. You will find that you can’t do so; you get an error
  631. message instead. This is because the Group field is linked to a validation
  632. table which means that only entries which appear in the table may be used in
  633. that field. Fields linked to validation tables are distinguished by using
  634. dark green, instead of black, as the foreground colour.
  635.  
  636. To see what the validation table contains, place the caret in the Group
  637. field then click on the List values button, (23). The validation table will
  638. be displayed in its own window. Only items in the left column of the table
  639. may be entered in the Group field. Element 108 would be a transition metal,
  640. so enter T. You will now find that Powerbase accepts your data.  Both
  641. character validation and table validation may be turned off and on by means
  642. of a switch on the Preferences window. To get at this window click MENU over
  643. the Powerbase icon on the iconbar and choose  Preferences  from the iconbar
  644. menu. The rather large window which appears has a collection of option
  645. switches down its left-hand side. The sixth of these (Validate input) is
  646. normally ON to indicate that validation is in effect. Click to turn it off
  647. then click on Accept. The Preferences window will be removed from the screen
  648. and you will find that input is no longer being validated.
  649.  
  650. 3.6 Deleting records
  651. --------------------
  652. Since “tasmanium” isn’t a real element we want to remove it from our
  653. database. Button (14), the “dustbin”,  will do exactly that but we won’t use
  654. it just yet.  Make sure that the unwanted record is on the screen and click
  655. button (16). You will now find that TASMANIUM has vanished; the names run
  656. from TANTALUM to TECHNETIUM and the atomic numbers end with 103, just as
  657. they did before you added the extra record.
  658.  
  659. What if you had clicked the button by mistake and deleted an important
  660. record? Powerbase handles this very nicely. The record hasn’t really been
  661. deleted at all. To prove this, click on (19). This shows a green
  662. right-pointing arrow and a “card index” icon. TASMANIUM will reappear. You
  663. will also find that it appears to be the only record in the file! Don’t
  664. worry; nothing has been lost. A Powerbase database is treated as six
  665. separate subfiles numbered 0-5. When you first open the database you are
  666. looking at Subfile 0 and the heading of the record window shows this. If you
  667. look at the heading now you will see that it has changed to Subfile 1.  The
  668. button you have just clicked advances the subfile number by 1. When you
  669. reach subfile 5 the next click takes you to subfile 0.  Its counterpart,
  670. button (18), has the opposite effect.
  671.  
  672. Buttons (15) and (16) do not delete records; they merely move records from
  673. one subfile to another. Button (16) moves the displayed record to the next
  674. subfile in sequence. Thus, in the above case TASMANIUM has been moved from
  675. subfile 0 to subfile 1. A record in subfile 1 would be moved to subfile 2
  676. and so on. When it gets to 5 the next click moves it into subfile 0 where it
  677. was originally. As you may have guessed, (15) moves records in the opposite
  678. direction, i.e. from subfile 1 to 0 or from subfile 0 to 5.
  679.  
  680. If you do want to lose a record for good you consign it to the dustbin by
  681. clicking (14).  As this button’s action is more drastic than that of the
  682. other two you are asked to confirm that this really is what you want to do
  683. before the deletion goes ahead.
  684.  
  685. 4  Printing Lists
  686. =================
  687. Before Powerbase can produce a list it must be told:
  688.  
  689. •       which fields should appear on the list
  690. •       which records should appear on the list.
  691.  
  692. 4.1 Making the field selection
  693. ------------------------------
  694. Specifying the fields you want is extremely easy. To include a field point
  695. the mouse at it and click with ADJUST. The selected field will appear with
  696. its foreground and background colours reversed. If you change your mind
  697. about a field you can de-select it by clicking on it again with ADJUST. The
  698. order in which the fields will appear in the printed list is the order in
  699. which you select them. Take care since there is nothing on the screen to
  700. indicate what order the fields will be in (although you can inspect the
  701. order once you have opened the Match window by clicking on the menu button
  702. labelled X in Fig.4).  The fields chosen for inclusion in a printout make up
  703. a selection which may be saved, using Save selection from the Print submenu,
  704. and reloaded for future use. Just for now select Name, Symbol and Group.
  705.  
  706. 4.3 Choosing which records to print
  707. -----------------------------------
  708. Specifying which records to print is more complicated. With the pointer in
  709. the record window click MENU. This displays the main Powerbase menu from
  710. which you should choose Print. A small window appears (see Fig.4) in which
  711. you specify the criteria which must be met by records for inclusion in the
  712. list. If you just click the Print button (or type Return) without entering
  713. anything here you will obtain a list of the whole database (or, more
  714. accurately, the the whole of the current subfile). Try this first.
  715.  
  716. Nothing will be printed until the process is complete. The list will then be
  717. displayed in a window. If no records at all are printed make sure the icon
  718. for subfile 0 (Y in Fig. 4) is highlighted. If the mouse pointer is over the
  719. main window the hourglass will tell you how far things have progressed.
  720. Pressing Escape will cause the process to be aborted. Assuming you now have
  721. a list in a window, clicking MENU over it displays a menu which leads to a
  722. Save box. You may  save the list as a text file by dragging the file icon to
  723. a filer window or print it by loading Printers and dropping the file icon on
  724. the Printers icon on the iconbar *. If you point to a record in the
  725. displayed list and double-click with SELECT Powerbase will display the
  726. chosen record in the main record window. Moreover the caret is placed in the
  727. field you were pointing to on the list. This is very useful if you spot
  728. errors in the data whilst examining a list. A double click on the offending
  729. item offers the record with the caret correctly positioned for editing.
  730.   
  731. Most database queries don’t, of course, involve printing all the records.
  732. You will usually need to enter a search formula before clicking Print. You
  733. have already used a simple search formula when you typed GP=1 to filter out
  734. all but the six Alkali Metal records (see 2.3). Search formulae can be
  735. complex and a more detailed treatment is given in  Ch03-Print. Only a few
  736. simple examples are shown here.
  737.  
  738. Suppose we want a list of all transitional elements. i.e. all those which
  739. have T in the GROUP field. We can do this by entering the search formula:
  740.  
  741.                                 GP=T
  742.  
  743. Why GP?  Group=T seems the more obvious choice but Elements contains many
  744. fields which have no label, such as the one on the first line which gives
  745. the origin of the element’s name. Every field which can hold data has to
  746. have a handle by which we can refer to it and that handle is called the
  747. field tag. Tags are very short; never more than four characters. You have
  748. seen some tags already. Look at the list you printed earlier. The three
  749. columns are headed with the tags (NAME, SYM and GP) not the descriptors
  750. (Name, Symbol and Group). We therefore meets tags in two contexts:
  751.  
  752. •       specifying fields in search formulae 
  753. •       as the default column headings in lists
  754.  
  755. The Print options window, displayed by choosing Options from the Print
  756. submenu, lets you change the column headings to field descriptors if you
  757. prefer them, but it is always the tags which are used in formulae.
  758.  
  759. Type GP=T in the space provided and click Print. This time the list will be
  760. a much shorter one and you will see that the GP column contains T in every
  761. case.
  762.  
  763. The second example involves printing all elements whose names end in “IUM”.
  764. What we need to specify is that the Name contains IUM and we do this by
  765. entering the search formula:
  766.  
  767.                                NAME{IUM  
  768.  
  769. Note the use of a left brace (curly bracket) to mean “contains”.  Another
  770. way to perform this search is to use a wild-card. Type:
  771.  
  772.                               NAME=$IUM 
  773.  
  774. Clicking Print will produce the same list as before. The “$” is a wild-card
  775. character which can represent any number of unspecified characters. The
  776. search formula is saying in effect, “I don’t care what the first part of the
  777. name is as long as it ends with IUM”.
  778.  
  779. We will combine the previous two examples into a two-pronged search for all
  780. the TRANSITIONAL elements whose names end in “IUM”. The search formula this
  781. time is either:
  782.  
  783.                           NAME{IUM AND GP=T
  784.      
  785.              or:         NAME=$IUM AND GP=T 
  786.  
  787. Note the spaces before and after AND. These are essential. You might like to
  788. try an alternative way of entering a search formula.  It is designed for new
  789. users of a database or for occasional users who might forget what the tags
  790. of the fields are.  Proceed as follows:
  791.  
  792. 1.      Click the Help button on Print window. This opens the Help window.  
  793. 2.      NAME should already be visible as the required field, but you need to select the radio button for contains.  
  794. 3.      Click in the space next to Value and enter IUM.         
  795. 4.      Click Add to formula.  The search formula now reads NAME{IUM.        
  796. 5.      Click the AND button.
  797. 6.      Click on the “menu” button to the right of the tag display and choose item 6 (GP) 
  798. 7.      Select the radio button for is equal to
  799. 8.      Enter T in the Value field.
  800. 9.      Click Add to formula
  801.  
  802. The complete search formula should now be visible so click Print and the
  803. list will be produced. The procedure takes far longer to describe than to do
  804. and can be a great help to the infrequent Powerbase user who has trouble
  805. remembering the syntax of search formulae. If you use complex queries often
  806. you may find it convenient to save them for future use. Save query from the
  807. Print submenu enables you to do this.
  808.  
  809. The biggest problem you are likely to encounter is not knowing the tags for
  810. the various fields. By using the above method you can see all the tags
  811. displayed in a menu or cycle through them using a pair of arrowheads (“bump”
  812. icons). It is also useful to know that clicking with SELECT on a field while
  813. holding down Ctrl causes the tag of that field to appear in the search
  814. formula icon. 
  815.  
  816. 5  Merging data into an Impression document
  817. ===========================================
  818. The distribution disc contains a simple Impression document called
  819. MergeTest. It will be used in conjunction with the Elements database to
  820. illustrate direct data-merging with Impression.
  821.  
  822. (1)     Ensure that Impression has been “seen” by the filer. (You need not
  823.         actually load it.)  
  824.  
  825. (2)     Open the Elements database and drop MergeTest onto the record
  826.         window. The Data merge window will appear. 
  827.  
  828. (3)     Click on Merge. You will see that data relating to the record for
  829.         ACTINIUM has been inserted into the Impression document.  
  830.  
  831. (4)     The browse buttons on the keypad, may be used to move through the
  832.         database merging different records into the document.  
  833.  
  834. (5)     If a Filter has been specified it will restrict the merge operation
  835.         to records matching the filter formula. 
  836.  
  837. (6)     Print may be used to print the document with the currently-merged
  838.         data. To print a set of documents, one for each matching element,
  839.         select Print all before clicking on Merge.
  840.  
  841. During data-merging Impression editing is disabled; you can’t place the
  842. caret in the document and the mouse pointer appears as a red and blue cross.
  843. Clicking on Cancel or closing the Data merge window restores normal editing.
  844.   
  845. For more information on data-merging, including instructions on how to
  846. prepare the Impression document, see Ch09-Merge.
  847.  
  848. 6  Closing down
  849. ===============
  850. A database may be closed down by choosing the Close database entry from the
  851. iconbar menu. When you do so, all the indices stored in memory are saved to
  852. disc and the database is closed. You do not have to do anything to save the
  853. database itself to disc since it has been there all along. Only the current
  854. record is in memory at any one time and this is automatically written back
  855. to disc when it has been changed in any way.
  856.   
  857. Also saved automatically is the link file which holds the links between
  858. the main database and the validation tables. The tables themselves are also
  859. saved.
  860.  
  861. If you are going to use another database straight away just double click on
  862. it or drag it to the Powerbase icon on the iconbar. In fact you don’t even
  863. need to close the previous database before doing this; Powerbase will do it
  864. for you.  When working with a database on the RAM disc Powerbase will issue
  865. a warning that the data is not secure and that you need to drag it from the
  866. RAM disc to a floppy or hard disc before switching off. To terminate
  867. Powerbase itself use the Quit option on the iconbar menu. 
  868.